<template>
  <div>
    <ShopHeader/>
      <ul class="tab-item"><!--replace 点击直接返回上一层页面 而不会返回当前的子页面-->
        <router-link tag="li" to="/shop/goods" replace>点餐</router-link>
        <router-link tag="li" to="/shop/ratings" replace>评价</router-link>
        <router-link tag="li" to="/shop/info" replace>商家</router-link>
      </ul>
    <keep-alive>
      <router-view/>
    </keep-alive>
  </div>
</template>

<script>
import ShopHeader from './shopheader/ShopHeader'
export default {
  name: 'Shop',
  components: {
    ShopHeader
  },
  mounted () {
    this.$store.dispatch('getShopInfo') // 通过vuex在actions中调取方法
  }
}
</script>

<style lang="stylus" scoped>
  @import "../../common/stylus/mixins.styl"
  .tab-item
    height 80px
    line-height 80px
    background #fff
    bottom-border-1px(rgba(7, 17, 27, 0.1))
    width 100%
    li
      text-align center
      font-size 28px
      color rgb(77, 85, 93)
      width: 33.33333%
      float left
      position relative
      &.router-link-active
        color #02a774
        &::after
          content ''
          position absolute
          left 50%
          bottom 2px
          width 70px
          height 4px
          transform translateX(-50%)
          background #02a774
</style>
